package com.itheima.controller;

import com.itheima.domain.Student;
import com.itheima.service.StudentService;

import java.util.Scanner;

public class StudentCon1 {
    public void view(){
        Scanner sc = new Scanner(System.in);
        ol:while (true){
            System.out.println("---学生管理---");
            System.out.println("1.添加 2.删除 3.退出");
            String index=sc.next();
            switch (index){
                case "1":
                    addstu();
                    break;
                case "2":
                    break;
                case "3":
                    System.out.println("退出学生管理");
                    break ol;
                default:
                    System.out.println("输入错误");
            }
        }
    }
    public void addstu(){
        StudentService studentService = new StudentService();
        Scanner sc = new Scanner(System.in);
        Student student = new Student();
        String id;
        System.out.println("请输入id:");

        System.out.println("请输入姓名:");
        student.setName(sc.next());
        System.out.println("请输入年龄:");
        student.setAge(sc.nextInt());
        System.out.println("请输入地址:");
        student.setAdr(sc.next());
        boolean ifstu=studentService.addstu(student);
    }
}
